<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:jsf="http://xmlns.jcp.org/jsf"
	xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
	xmlns:p="http://primefaces.org/ui">
<f:view>
	<f:metadata>
		<f:viewParam name="id" value="#{trabajadorCRUDBean.idtrabajador}" />
		<f:viewAction action="#{trabajadorCRUDBean.loadTrabajadorForEdit()}" />
		<f:viewAction action="#{menuMB.updateMenu(31)}" />
	</f:metadata>
	<ui:composition template="/WEB-INF/templates/defaultLayout.xhtml">

		<!-- Definiendo la cabecera de la pagina -->
		<ui:define name="title">
			<h:outputText value="Trabajador" />
		</ui:define>


		<!-- Definiendo el cuerpo de la pagina -->
		<ui:define name="content">

			<h:outputStylesheet library="css" name="main.css" />

			<h:panelGroup rendered="#{trabajadorCRUDBean.succes}">
				<h:form>
					<div class="modal-dialog-bg"
						style="opacity: 0.4; width: 1366px; height: 1002px;"></div>
					<div class="modal-dialog p6n-popup"
						style="left: 502px; top: 200px;">
						<div class="modal-dialog-title modal-dialog-title-draggable">
							<span class="modal-dialog-title-text">Creación
								Satisfactoria</span><span class="modal-dialog-title-close"></span>
						</div>
						<div class="modal-dialog-content ng-binding">El trabajador
							fue actualizado satistactoriamente.</div>
						<div class="modal-dialog-buttons">
							<h:commandButton value="Crear Nuevo"
								action="create?faces-redirect=true" immediate="true" />
							<h:commandButton value="Volver" action="list?faces-redirect=true"
								immediate="true" />
						</div>
					</div>
				</h:form>
			</h:panelGroup>
			<h:panelGroup rendered="#{trabajadorCRUDBean.failure}">
				<h:form>
					<div class="p6n-api-access-in-page-error" style="left: 516px;">
						<div>
							<div>
								<p>
									<h:messages />
								</p>
							</div>
						</div>
					</div>
				</h:form>
			</h:panelGroup>

			<h:form>
				<p:focus id="formFocus" for="cmbTipodocumento"/>
				<br />
				<div>
					<div style="margin-left: 50px;">
						<div>
							<div>
								<div class="p6n-api-consent-screen-title">TRABAJADOR</div>
								<div class="p6n-api-consent-screen-inputs">
									<div>
										<h3 class="p6n-api-consent-screen-title"
											style="color: #298B11;">Agencia</h3>
										<div class="p6n-api-consent-screen-input-section">
											<div style="display: inline-block; width: 190px;">
												<div class="p6n-api-consent-screen-label">
													<h:outputLabel
														value="#{trabajadorCRUDBean.agencia.denominacion}" />
												</div>
											</div>
										</div>
									</div>
									<div class="sf-separator">
										<h3 class="p6n-api-consent-screen-title"
											style="color: #298B11;">Datos Generales</h3>
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div style="display: inline-block; width: 190px;">
											<div class="p6n-api-consent-screen-label">TIPO
												DOCUMENTO</div>
											<div>
												<h:selectOneMenu id="cmbTipodocumento"
													value="#{trabajadorCRUDBean.comboTipodocumento.itemSelected}"
													required="true"
													requiredMessage="Seleccione tipo de documento">
													<f:selectItem itemLabel="--Seleccione--" itemValue="" />
													<f:selectItems
														value="#{trabajadorCRUDBean.comboTipodocumento.items.entrySet()}"
														var="val" itemLabel="#{val.value.abreviatura}"
														itemValue="#{val.key}" />
													<f:ajax></f:ajax>
												</h:selectOneMenu>
											</div>
										</div>
										<div style="display: inline-block; width: 190px;">
											<div class="p6n-api-consent-screen-label">NUMERO
												DOCUMENTO</div>
											<div>
												<h:inputText id="txtNumerodocumento"
													value="#{trabajadorCRUDBean.numerodocumento}"
													required="true" maxlength="15" autocomplete="off"
													requiredMessage="Ingrese numero documento"
													validatorMessage="Número de documento Invalido"
													converterMessage="Número de documento Invalido"
													pt:placeholder="Numero Documento">
													<f:convertNumber type="number" integerOnly="true"
														groupingUsed="false" />
													<f:ajax
														listener="#{trabajadorCRUDBean.buscarPersonanatural()}"
														render="@form"></f:ajax>
												</h:inputText>
											</div>
										</div>
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="cmbTipodocumento" />
										<h:message for="txtNumerodocumento" />
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div style="display: inline-block; width: 190px;">
											<div class="p6n-api-consent-screen-label">APELLIDO
												PATERNO</div>
											<div>
												<div>
													<h:inputText id="txtApellidoPaterno"
														value="#{trabajadorCRUDBean.apellidopaterno}"
														required="true" maxlength="50" autocomplete="off"
														requiredMessage="Ingrese apellido paterno"
														onkeyup="this.value = this.value.toUpperCase();"
														pt:placeholder="Apellido Paterno">
													</h:inputText>
												</div>
											</div>
										</div>
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label">APELLIDO
												MATERNO</div>
											<div>
												<div>
													<h:inputText id="txtApellidoMaterno"
														value="#{trabajadorCRUDBean.apellidomaterno}"
														required="true" maxlength="50" autocomplete="off"
														requiredMessage="Ingrese apellido paterno"
														onkeyup="this.value = this.value.toUpperCase();"
														pt:placeholder="Apellido Paterno">
													</h:inputText>
												</div>
											</div>
										</div>
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="txtApellidoPaterno" />
										<h:message for="txtApellidoMaterno" />
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label">NOMBRES</div>
										<div>
											<div>
												<h:inputText id="txtNombres" autocomplete="off"
													value="#{trabajadorCRUDBean.nombres}" required="true"
													maxlength="60" requiredMessage="Ingrese nombres"
													onkeyup="this.value = this.value.toUpperCase();"
													pt:placeholder="Nombres" style="width:339px;">
												</h:inputText>
											</div>
										</div>
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="txtNombres" />
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div style="display: inline-block; width: 190px;">
											<div class="p6n-api-consent-screen-label">SEXO</div>
											<div>
												<div>
													<h:selectOneMenu id="cmbSexo"
														value="#{trabajadorCRUDBean.comboSexo.itemSelected}"
														required="true" requiredMessage="Seleccione sexo">
														<f:selectItem itemLabel="--Seleccione--" itemValue="" />
														<f:selectItems
															value="#{trabajadorCRUDBean.comboSexo.items.entrySet()}"
															var="val" itemLabel="#{val.value.denominacion}"
															itemValue="#{val.key}" />
													</h:selectOneMenu>
												</div>
											</div>
										</div>
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label">FECHA DE
												NACIMIENTO</div>
											<div>
												<div>
													<p:calendar id="txtFechanacimiento" autocomplete="off"
														value="#{trabajadorCRUDBean.fechanacimiento}"
														navigator="true" pattern="dd/MM/yy" required="true"
														requiredMessage="Ingrese fecha de nacimiento"
														converterMessage="formato incorrecto"
														pt:placeholder="dd/mm/yyyy">
														<f:convertDateTime pattern="dd/MM/yy" timeZone="EST" />
													</p:calendar>
												</div>
											</div>
										</div>
									</div>
									<div
										class="p6n-api-consent-screen-input-error p6n-api-consent-screen-product-name-error-msg">
										<h:message for="cmbSexo" />
										<h:message for="txtFechanacimiento" />
									</div>
									<br />
									<div class="sf-separator">
										<h3 class="p6n-api-consent-screen-title"
											style="color: #298B11;">Datos Adicionales</h3>
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div>
											<div style="display: inline-block; width: 190px;">
												<div class="p6n-api-consent-screen-label">ESTADO CIVIL</div>
												<div>
													<h:selectOneMenu id="cmbEstadocivil"
														value="#{trabajadorCRUDBean.comboEstadocivil.itemSelected}">
														<f:selectItem itemLabel="--Seleccione--" itemValue="" />
														<f:selectItems
															value="#{trabajadorCRUDBean.comboEstadocivil.items.entrySet()}"
															var="val" itemLabel="#{val.value.denominacion}"
															itemValue="#{val.key}" />
													</h:selectOneMenu>
												</div>
											</div>
											<div style="display: inline-block;">
												<div class="p6n-api-consent-screen-label">OCUPACION</div>
												<div>
													<h:inputText value="#{trabajadorCRUDBean.ocupacion}"
														onkeyup="this.value = this.value.toUpperCase();"
														maxlength="70" pt:placeholder="Ocupacion" autocomplete="off"/>
												</div>
											</div>
										</div>
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div style="display: inline-block; width: 190px;">
											<div class="p6n-api-consent-screen-label">DIRECCION</div>
											<div>
												<div>
													<h:inputText value="#{trabajadorCRUDBean.direccion}"
														onkeyup="this.value = this.value.toUpperCase();"
														maxlength="150" pt:placeholder="Direccion" autocomplete="off">
													</h:inputText>
												</div>
											</div>
										</div>
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label">REFERENCIA</div>
											<div>
												<div>
													<h:inputText value="#{trabajadorCRUDBean.referencia}"
														onkeyup="this.value = this.value.toUpperCase();"
														maxlength="100" pt:placeholder="Referencia" autocomplete="off">
													</h:inputText>
												</div>
											</div>
										</div>
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div style="display: inline-block; width: 190px;">
											<div class="p6n-api-consent-screen-label">TELEFONO</div>
											<div>
												<div>
													<h:inputText value="#{trabajadorCRUDBean.telefono}"
														maxlength="25" pt:placeholder="066000000" autocomplete="off">
													</h:inputText>
												</div>
											</div>
										</div>
										<div style="display: inline-block;">
											<div class="p6n-api-consent-screen-label">CELULAR</div>
											<div>
												<div>
													<h:inputText value="#{trabajadorCRUDBean.celular}"
														maxlength="25" pt:placeholder="Ceular/RPM" autocomplete="off">
													</h:inputText>
												</div>
											</div>
										</div>
									</div>
									<div class="p6n-api-consent-screen-input-section">
										<div class="p6n-api-consent-screen-label">EMAIL</div>
										<div>
											<div>
												<h:inputText value="#{trabajadorCRUDBean.email}"
													onkeyup="this.value = this.value.toUpperCase();"
													maxlength="50" pt:placeholder="example@domain.com"
													style="width:339px;" autocomplete="off"/>
											</div>
										</div>
									</div>
									<br />
									<div class="sf-buttons" style="float: left;">
										<h:commandButton value="Guardar"
											action="#{trabajadorCRUDBean.createTrabajador()}"
											styleClass="action blue" />
										<h:commandButton value="Cancelar" immediate="true"
											action="list?faces-redirect=true" styleClass="action" />
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</h:form>



		</ui:define>

	</ui:composition>
</f:view>
</html>
